package com.lh.createData.service.Impl;

import com.lh.createData.dao.ProjectAndProductMapper;
import com.lh.createData.model.InPutParam.ProjectAndProductInsertInParam;
import com.lh.createData.service.ProjectAndProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ：梁昊，后端工程师：梁昊
 * @create 2021-07-21 16:53
 * @function
 * @editLog
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
public class ProjectAndProductServiceImpl implements ProjectAndProductService {
    @Autowired
    ProjectAndProductMapper projectAndProductMapper;

    /**
     * 增加产品与项目的关系统计表
     *
     * @param projectAndProductInsertInParam com.lh.createData.model.InPutParam.ProjectAndProductInsertInParam
     * @return 影响条数
     */
    @Override
    public int insertProjectAndProduct(ProjectAndProductInsertInParam projectAndProductInsertInParam) {
        final int i = projectAndProductMapper.insertProjectAndProductBeforeCheck(projectAndProductInsertInParam);
        if (i == 0)
            return projectAndProductMapper.insertProjectAndProduct(projectAndProductInsertInParam);
        else
            return 0;
    }

    /**
     * 删除所有产品与项目的关系统计表
     *
     * @return 影响条数
     */
    @Override
    public int deleteProjectAndProduct() {
        return projectAndProductMapper.deleteProjectAndProduct();
    }

}